package main.java.cn.wolfcode.qo;

import cn.hutool.core.date.DateUtil;
import cn.wolfcode.enums.ConsumptionReportEnum;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * @author admin
 * @program: car-business
 * @description: 封装报表查询的参数
 * @date 2021-01-12 12:57:58
 */
@Setter
@Getter
public class ConsumptionReportQueryObject extends QueryObject {
    //分组类型的枚举

    private String groupType= ConsumptionReportEnum.BUSINESS.getValue();
    private Long businessId;
    private Boolean appointmentType;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date beginDate;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endDate;

    public Date getEndDate(){
        if(endDate!=null){
            //设置当天的最晚时间
            return DateUtil.endOfDay(endDate);
        }
        return null;
    }

}
